package com.googlecode.cswish.struts;

import java.lang.reflect.Member;
import java.util.Map;

import com.opensymphony.xwork2.conversion.impl.XWorkConverter;

/**
 * This is a temporary class to resolve a xwork defect<br>
 * Fix a dead cycle error -- http://jira.opensymphony.com/browse/XW-592
 * 
 * @author Jerry.Feng 2008-10-18
 */
public class FixedXWorkBasicConverter extends XWorkConverter {

	@Override
	public Object convertValue(Map context, Object target, Member member, String property, Object value, Class toClass) {
		if (value != null && value instanceof Object[]) {
			if (((Object[])value).length == 0) {
				return null;
			}
		}
		return super.convertValue(context, target, member, property, value, toClass);
	}
	
	@Override
	public Object convertValue(Object value, Class toType) {
		return super.convertValue(null, value, toType);
	}
}